document.addEventListener('DOMContentLoaded', () => {
    // 模拟从后端获取数据
    fetch('http://localhost:8082/chargeStation/getYesTotalEle') // 替换为你的后端API地址
        .then(response => response.json())
        .then(data => {
            const container = document.getElementById('data-container');
            data.data.forEach(item => {
                const ul = document.createElement('ul');

                const liName = document.createElement('li');
                liName.textContent = item.name;
                liName.classList.add('project-name-up'); // 添加特定的 CSS 类
                ul.appendChild(liName);

                const liCapacity = document.createElement('li');
                liCapacity.textContent = item.capacity;
                ul.appendChild(liCapacity);

                const liDailyEle = document.createElement('li');
                liDailyEle.textContent = item.dailyEle;
                ul.appendChild(liDailyEle);

                const liMonthEle = document.createElement('li');
                liMonthEle.textContent = item.monthEle;
                ul.appendChild(liMonthEle);

                const liYearEle = document.createElement('li');
                liYearEle.textContent = item.yearEle;
                ul.appendChild(liYearEle);

                const liAccumulateEle = document.createElement('li');
                liAccumulateEle.textContent = item.accumulateEle;
                ul.appendChild(liAccumulateEle);

                const liHour = document.createElement('li');
                liHour.textContent = item.hour;
                ul.appendChild(liHour);

                container.appendChild(ul);
            });
        })
        .catch(error => console.error('Error fetching data:', error));
});


